package com.google.code.sysarch.v0.e35;

import com.google.code.sysarch.common.util.Buffer;

public class ThreadBuffer implements Buffer {
	int buffer[];
	boolean IObuffer[];

	public ThreadBuffer(int n) {
		buffer = new int[n];
		IObuffer = new boolean[n];
		for (int i = 0; i < n; i++) {
			buffer[i] = 0;
			IObuffer[i] = false;
		}
	}

	public void setBuffer(int pos, int length) {
		buffer[pos] = length;
	}
 
	public void setIOBuffer(int pos, boolean value) {
		IObuffer[pos] = value;
	}

	public int getBuffer(int pos) {
		return buffer[pos];
	}
 
	public boolean getIOBuffer(int pos) {
		return IObuffer[pos];
	}

	public boolean isEmpty() {
		for (int i = 0; i < buffer.length; i++) {
			if (buffer[i] < 99) {
				return false;
			}
		}
		return true;
	}
 
	public int getMax() {
		return buffer.length;
	}
 
	public String getRevision() {
		return "0.0.0.1";
	}
}
